package view.items;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;

import controller.Controller;

public class PanelSlider extends JPanel {

	private Controller controller;
	private JSlider slide;
	private JLabel slideLabel;

	public PanelSlider(Controller controller) {
this.controller=controller;
slideLabel = new JLabel("Voice Level Activation : "+ this.controller.getModel().getSelectedCall().getVoiceActivationLevel()+"   ");
slideLabel.setPreferredSize(new Dimension(175, 25));
this.add(slideLabel);
slide = new JSlider();
slide.setMaximum(100);
slide.setPreferredSize(new Dimension(200,40));
slide.setMinimum(0);
slide.setValue((int) this.controller.getModel().getSelectedCall().getVoiceActivationLevel());
slide.setPaintTicks(true);
slide.setPaintLabels(true);
slide.setBackground(Color.orange);
slide.addChangeListener(controller);
this.add(slide);
this.setBackground(Color.orange);

	}

	public void refresh() {
		slide.setValue((int)this.controller.getModel().getSelectedCall().getVoiceActivationLevel());
		slideLabel.setText("Voice Level Activation : "+ this.controller.getModel().getSelectedCall().getVoiceActivationLevel()+"   ");
		
		
	}

	
	
	
}
